package psmanager.conv;


public class Triplet<L,M,R> {
	 
    private L left;
    private M middle;
    private R right;

    
    public Triplet(L left, M middle, R right) {
		super();
		this.left = left;
		this.middle = middle;
		this.right = right;
	}

	public L getLeft() {
		return left;
	}
	public M getMiddle() {
		return middle;
	}
	public R getRight() {
		return right;
	}

	public void setLeft(L left) {
		this.left = left;
	}
	public void setMiddle(M middle) {
		this.middle = middle;
	}
	public void setRight(R right) {
		this.right = right;
	}
	

	public static <A, B, C> Triplet<A,B,C> create(A left, B middle, C right) {
        return new Triplet<A,B,C>(left, middle, right);
    }
 
    public final boolean equals(Object o) {
        if (!(o instanceof Triplet<?, ?, ?>))
            return false;
 
        final Triplet<?, ?, ?> other = (Triplet<?, ?, ?>) o;
        return equal(getLeft(), other.getLeft()) &&
        			equal(getRight(), other.getRight()) &&
        				equal(getMiddle(), other.getMiddle());
    }
    
    public static final boolean equal(Object o1, Object o2) {
        if (o1 == null) {
            return o2 == null;
        }
        return o1.equals(o2);
    }
 
    public int hashCode() {
        int hLeft = getLeft() == null ? 0 : getLeft().hashCode();
        int hMiddle = getMiddle() == null ? 0 : getMiddle().hashCode();
        int hRight = getRight() == null ? 0 : getRight().hashCode();
 
        return hLeft + (57 * hRight) + (113*hMiddle);
    }
}